package com.itany.corejava.day14;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class TestInputStreamReader {

    public static void main(String[] args) {


        try(FileInputStream fis=new FileInputStream("d:/a.txt");
            InputStreamReader isr=new InputStreamReader(fis,"utf-8");
            OutputStreamWriter osw=new OutputStreamWriter(
                    new FileOutputStream("d:/b.txt"),"utf-8"
            )){


            System.out.println(isr.getEncoding());


            char[] c=new char[1000];

            int n;

            while((n=isr.read(c))!=-1){
                System.out.print(new String(c,0,n));

                osw.write(c,0,n);
            }

        }catch (Exception e){
            e.printStackTrace();
        }




    }
}
